package com.num2.dao.lkw;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import com.num2.form.lkw.Deposit_Money;
import com.num2.form.lkw.Withdraw_Money;

public interface ITransferDao {
	//通过username获取user_id
	@Select("select user_id from user_info where user_name = #{user_name}")
	public int selectName(String user_name);
	//通过user_id查询余额
	@Select("select balance from transaction_record where transaction_id=(select max(transaction_id) from transaction_record where user_id = #{user_id}) ")
	public int selectId(int user_id);
	//添加出账记录
	@Insert("insert into transaction_record (user_id,income_expend,transaction_date,balance) values (#{user_id},#{income_expend},#{transaction_date},#{balance})")
	public int delete(Withdraw_Money wm);
	//通过username获取对方账户的user_id
	@Select("select user_id from user_info where user_name = #{user_name}")
	public int selectNm(String user_name);
	//通过对方user_id获取对方余额
	@Select("select balance from transaction_record where transaction_id=(select max(transaction_id) from transaction_record where user_id = #{user_id}) ")
	public int selectid(int user_id);
	//添加入账记录
	@Insert("insert into transaction_record (user_id,income_expend,transaction_date,balance) values (#{user_id},#{income_expend},#{transaction_date},#{balance})")
	public int add(Deposit_Money dm);
}
